Byteman is going for a car trip around Byteland, but he is unfortunately unable to buy a map of the country. His friends told him about some properties of the bytean road network:
cities in Byteland, numbered from
to
.
roads.
and
are connected by a road on the first plan
then their equivalents
and
are also connected by a road on the
second plan.
Write a program that:
,
and
from the standard input,
,
The first and only line of the input contains three integers
,
and
(
,
,
,
is a prime number), separated with single spaces.
The first and only line of output should contain a single integer
- the remainder of the division by
of the number of different
plans that are consistent with conditions known to Byteman.
For the input data:
6 3 13
the correct result is:
2

Task author: Jakub Radoszewski.
In the event of technical difficulties with Szkopuł, please contact us via email at [email protected].
If you would like to talk about tasks, solutions or technical problems, please visit our Discord servers. They are moderated by the community, but members of the support team are also active there.